package actions;

import java.sql.SQLException;
import java.util.Vector;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.sql.RowSet;

import model.ReviewerModel;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import db.DbException;
import forms.ReviewRecommendForm;
//import model.UniversityModel;
//import model.UserModel;

public class ReviewerRecommendAction extends Action {

	private static final boolean DEBUG = true;
	//private static final int UNKNOWN = -1;
	
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) throws DbException {
		
		// get reviewer user info from form
		ReviewRecommendForm rform = (ReviewRecommendForm)form;
		String user = rform.getUser();
		
		if (DEBUG) {
			System.err.println("ReviewerRecommendAction: user(" + user +")");
		}
	
		String first = (String)request.getSession().getAttribute("fname");
		String middle = (String)request.getSession().getAttribute("mname");
		String last = (String)request.getSession().getAttribute("lname");
		
		// Insert the review
		ReviewerModel.insertReview(first, middle, last, user);

		return mapping.findForward("success");
	}
	
}